package com.luyang.platform.contact.application.user;

import com.luyang.platform.contact.application.user.ability.UserCreateAbility;
import com.luyang.platform.contact.application.user.command.CreateUserCommand;
import com.luyang.platform.contact.application.user.result.UserCreatedResult;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户应用服务
 *
 * @author lu_yang
 */
@Service
@RequiredArgsConstructor
public class UserApplicationService {

    private final UserCreateAbility userCreateAbility;

    @Transactional(rollbackFor = Exception.class)
    public UserCreatedResult create(CreateUserCommand command) {
        this.userCreateAbility.executeAbility(command);
        return new UserCreatedResult(null);
    }
}
